package edu.nf.ch04;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author wangl
 * @date 2025/4/28
 */
public class UserService implements InitializingBean, DisposableBean {

    public UserService() {
        System.out.println("执行Bean的构造方法");
    }

    public void initMethod() {
        System.out.println("由spring容器执行init-method方法");
    }

    public void destroyMethod() {
        System.out.println("由spring容器执行destroy-method方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("由spring容器执行方afterPropertiesSet法");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("由spring容器执行方destroy法");
    }
}